'use strict';
module.exports = function (sequelize, DataTypes) {

  var OnlineStatus = sequelize.define('OnlineStatus', {
    id: {
      type: DataTypes.INTEGER.UNSIGNED,
      primaryKey: true,
      autoIncrement: true
    },
    userId: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false,
      unique: true
    },
    status: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false
    },
    os: {
      type: DataTypes.STRING(20),
      allowNull: true
    },
    timestamp: {
      type: DataTypes.BIGINT.UNSIGNED,
      allowNull: false,
      defaultValue: 0
    }
  }, {
    tableName: 'online_statuses'
  });

  return OnlineStatus;
};
